package chapter2;

public class PassByValue {

    /**
     * @param args
     */
    public static void main(String[] args) {
        double one = 1.0;
        
        System.out.println("before: one = " + one);
        halveIt(one);
        System.out.println("after: one = " + one);
        
        Body body = new Body("123");
        System.out.println("before: " + body);
        setNull(body);
        System.out.println("after: " + body);
    }
    
    public static void halveIt(double arg){
        arg /=2.0;
        System.out.println("halved: arg = " + arg);
    }
    
    public static void setNull(Body body){
        body.setName("abc");
        body = null;
    }

}
